-
Notifications
You must be signed in to change notification settings - Fork 1.8k
task solution #2431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
task solution #2431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Summary
Your solution meets the core functional requirements: the abstract Machine
class is defined correctly, each subclass (Bulldozer
, Excavator
, Truck
) overrides public void doWork()
and public void stopWork()
, and MainApp
demonstrates polymorphism with a Machine[]
and the required calls. The issues identified are minor formatting and grammar polish, not functional blockers.
Minor fixes to address next:
- Remove redundant empty lines per the checklist:
Bulldozer.java
: delete the blank line right after the class opening brace and the blank line between the two methods (so the second@Override
follows immediately after the first method’s closing brace).Excavator.java
: remove the empty line after the package declaration and the one betweendoWork()
and the next@Override
.Machine.java
: remove the blank line after the package declaration, the blank line right after the class declaration, and the extra blank line between method declarations.Truck.java
: remove the blank line after the package declaration and the one betweendoWork()
and the next@Override
.
- Optional polish: change "it's" to the possessive "its" in messages like "Bulldozer started its work!" for grammatical correctness.
Nice work implementing the hierarchy and showcasing polymorphism clearly. With the small formatting cleanups, your code will align perfectly with the checklist.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
package core.basesyntax; | ||
|
||
public class Bulldozer extends Machine { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has a redundant empty line immediately after the class declaration. This violates the checklist item: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove the blank line so the first @Override
appears directly after the opening brace of the class. See the checklist guidance for examples .
public void doWork() { | ||
System.out.println("Bulldozer started it's work!"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a redundant blank line between the two method blocks. This also violates the checklist item: "Please don't add redundant empty lines to your code. We don't need them after class declaration or method signature." Remove this blank line so the second @Override
comes immediately after the first method's closing brace. See the checklist guidance for examples .
|
||
@Override | ||
public void doWork() { | ||
System.out.println("Bulldozer started it's work!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: the printed message uses the contraction it's
("Bulldozer started it's work!"). For grammatical correctness prefer the possessive its
("Bulldozer started its work!"). The checklist requires informative English messages and this is a small polish to meet that expectation more cleanly .
@@ -0,0 +1,13 @@ | |||
package core.basesyntax; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is an unnecessary blank line. It violates the checklist guidance: "Please don't add redundant empty lines to your code." Remove the empty line between the package declaration and the class declaration to match the project's formatting guidelines.
public void doWork() { | ||
System.out.println("Excavator started it's work!"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank line between the end of doWork()
and the next @Override
is redundant. It violates the checklist guidance: "Please don't add redundant empty lines to your code." Remove it so methods/annotations appear without unnecessary empty lines.
@@ -0,0 +1,8 @@ | |||
package core.basesyntax; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant blank line after the package declaration. This violates the checklist item: "Please don't add redundant empty lines to your code." Remove the blank line so the package
statement is followed immediately by the class declaration .
package core.basesyntax; | ||
|
||
public abstract class Machine { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant blank line immediately after the class declaration. This violates the checklist item: "Please don't add redundant empty lines to your code." Remove this blank line so the class declaration is followed directly by its members .
public abstract class Machine { | ||
|
||
public abstract void doWork(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant blank line between method declarations. This violates the checklist item: "Please don't add redundant empty lines to your code." Remove the blank line so method signatures and their neighbors are not separated by unnecessary empty lines .
@@ -0,0 +1,13 @@ | |||
package core.basesyntax; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unnecessary blank line. It violates the checklist guidance: "Please don't add redundant empty lines to your code." Remove the empty line between the package declaration and the class declaration to match the project's formatting guidelines.
public void doWork() { | ||
System.out.println("Truck started it's work!"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank line between the end of doWork()
and the next @Override
is redundant and violates the checklist rule: "Please don't add redundant empty lines to your code." Remove it so the annotation and method follow immediately without an extra empty line.
Created abstract Machine class and created classes Truck, Excavator, Bulldozer that inherited Machine. Ovirrided methods from abstract class.